<template>
	<view class="">
		<view class="job">
			<view class="title u-font-40 font-b u-text-center">
				<text>我的目标职业</text>
			</view>
			<view class="jobBox">
				<view class="name">
					<text>职业名称</text>
				</view>
				<view class="nameList" v-for="item in JobList" v-if="JobList.length>0">
					<text @click="jump(item)">{{item.busineName}}</text>
				</view>
				<view class="notice" v-if="JobList.length<=0">
					<text>您还未添加目标职业，请在完整报告中选择职业进行添加</text>
				</view>
			</view>
			<!-- 我的目标专业 -->
			<view class="title u-font-40 font-b u-text-center">
				<text>我的目标专业</text>
			</view>
			<view class="jobBox">
				<view class="name">
					<text>专业名称</text>
				</view>
				<view class="nameList" v-for="item in zhuanyeList" v-if="zhuanyeList.length>0">
					<text @click="jump(item)">{{item.busineName}}</text>
				</view>
				<view class="notice" v-if="zhuanyeList.length<=0">
					<text>您还未添加目标专业，请在完整报告中选择专业进行添加</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapActions,
		mapMutations
	} from 'vuex'
	import {
		request
	} from "../../../util/api";
	export default {
		data() {
			return {}
		},
		created() {
			// this.getGlobalData()
			this.$store.commit('getGlobalData')
		},
		computed: {
			...mapState({
				JobList: state => state.JobList,
				zhuanyeList: state => state.zhuanyeList
			})
		},
		methods: {
			// 获取目标职业目标专业数据
			// getGlobalData() {
			// 	request({
			// 		url: "/system/compassMajobMine/queryByUserType",
			// 		method: "post",
			// 		data: {
			// 			mjUser: uni.getStorageSync(process.env.NODE_ENV + 'zbz_user').userId
			// 		}
			// 	}).then(res => {
			// 		let dataList = res.data
			// 		this.JobList=[]
			// 		this.zhuanyeList=[]
			// 		for (let item of dataList) {
			// 			// 目标职业数组
			// 			if (item.mjType === "1") {
			// 				this.JobList.push(item)
			// 			} else {
			// 				this.zhuanyeList.push(item)
			// 			}
			// 		}
			// 	})
			// },
			//点击跳转职业专业详情页面
			jump(item) {
				if (item.mjType === "1") {
					this.$u.route({
						url: '/pages/explore/job_detail?id=' + item.busineId,
					})
				} else {
					this.$u.route({
						url: '/pages/explore/zhuanye_detail?code=' + item.busineId,
					})
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
	.title {
		margin-bottom: 40rpx;
	}

	.jobBox {
		margin-bottom: 40rpx;

		.name {
			width: 532rpx;
			height: 60rpx;
			background-color: #406FA8;
			text-align: center;
			margin: 0 auto;
			line-height: 60rpx;
			color: #FFFFFF;
		}

		.nameList {
			width: 532rpx;
			height: 60rpx;
			text-align: center;
			margin: 0 auto;
			line-height: 60rpx;
			background-color: #ECEFF0;
			color: #406FA8;
			border-bottom: 1rpx solid #FFFFFF;
		}
	}

	.myGlobalJob {
		margin-bottom: 40rpx;
	}



	.title {
		margin-bottom: 40rpx;
	}

	.name {
		width: 532rpx;
		height: 106rpx;
		line-height: 106rpx;
		background-color: #406FA8;
		text-align: center;
		margin: 0 auto;
		color: #FFFFFF;
	}

	.notice {
		width: 532rpx;
		background-color: #ECEFF0;
		margin: 0 auto;
		text-align: center;
		padding: 10rpx 0;
	}
</style>
